package edu.tmue.cs.m100;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

public class GenTsp {

	public static void main(String[] args) {
		Set<String> set = new HashSet<String>();

		while (set.size() < 1000) {
			int x = (int) (Math.random() * 100) + 1;
			int y = (int) (Math.random() * 100) + 1;
			set.add(x + "," + y);
		}
		BufferedWriter bwriter = null;
		try {
			bwriter = new BufferedWriter(new FileWriter(
					"C:/workspace/Algorithm/TSP.txt"));
			int count = 0;
			for (String tmpStr : set) {
				String[] aryStr = tmpStr.split(",");

				bwriter.write(count + "\t" + aryStr[0] + "\t" + aryStr[1]
						+ "\n");

				count++;
			}
			bwriter.flush();
			// bwriter.write(sb.toString());
			// bwriter.close();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				bwriter.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

	}

}
